import { ABCWidgetFactory, DocumentRegistry } from '@jupyterlab/docregistry';

import { MindElixirDocModel } from './mindElixirModel';

import { MindElixirPanel, MindElixirDocWidget } from './mindElixirWidget';

export class MindElixirWidgetFactory extends ABCWidgetFactory<
  MindElixirDocWidget,
  MindElixirDocModel
> {
  /**
   * Constructor of ExampleWidgetFactory.
   *
   * @param options Constructor options
   */
  constructor(options: DocumentRegistry.IWidgetFactoryOptions) {
    super(options);
  }

  /**
   * Create a new widget given a context.
   *
   * @param context Contains the information of the file
   * @returns The widget
   */
  protected createNewWidget(
    context: DocumentRegistry.IContext<MindElixirDocModel>
  ): MindElixirDocWidget {
    console.log('MindElixirWidgetFactory createNewWidget'); 
    return new MindElixirDocWidget({
      context,
      content: new MindElixirPanel(context)
    });
  }
}